// pages/visitors/tools/list/com/module-text/module-text.js
import api from "../../../../../../common/api";
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    content: [
    ]
  },
  lifetimes: {
    attached: function () {
      this.getEssayList();
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    //复制
    copyText(e){
      wx.setClipboardData({
        data: e.target.dataset.text,
        success: function (res) {
          wx.getClipboardData({
            success: function (res) {
              wx.showToast({
                title: '复制成功',
              })
            }
          })
        }
      })
    },
    //获取短文
    getEssayList(){
      api.getEssayList({
        essayType: 'ESSAYMARKETING'
      }, res => {
        this.setData({
          content: res.data.content
        })
      })
    }
  }
})
